﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Linq;

namespace AssetDetect.Editor
{
    /// <summary>
    /// 检测不支持的图片格式
    /// </summary>
    public class UnsupportedFormatEditor : UnityEditor.AssetPostprocessor
    {
        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            string[] unsupported = importedAssets.Where(item => item.ToLower().EndsWith(".dds")).ToArray();
            if (unsupported.Length > 0)
            {
                string list = string.Join("\n", unsupported);
                EditorUtility.DisplayDialog("警告", $@".dds图片格式无法跨平台兼容
请转换为.png格式，谢谢！
{list}", "确定");
            }
        }
    }
}
